package dao;

import pojo.User;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;

/**
 * 操作数据库yonghu表的类
 */
public interface UserDao {
    /**
     * 判断用户名或密码--登录
     *
     * @param usename
     * @param password
     * @return
     * @throws SQLException
     */
    boolean login(String usename, String password) throws SQLException;

    /**
     * 修改用户信息，返回是否修改成功布尔值
     *
     * @param user
     * @return
     * @throws SQLException
     * @throws IllegalAccessException
     */
    boolean update(User user) throws SQLException, IllegalAccessException;

    /**
     * 传入一个注册用户对象，存入数据库
     *
     * @param user
     * @return
     * @throws SQLException
     */
    boolean addRegist(User user) throws SQLException;

    /**
     * 根据用户名获取某个具体用户的详细信息--用户查询修改资料
     *
     * @param uid
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    User getUser(Integer uid) throws SQLException, ClassNotFoundException;

    //public HashSet<User> areaUsers(String type);

    /**
     * 查找管理员姓名
     *
     * @param user
     * @return
     * @throws SQLException
     */
    boolean updatePower(User user) throws SQLException;

    /**
     * 查找mid
     *
     * @param uid
     * @return
     * @throws SQLException
     */
    boolean findPower(Integer uid) throws SQLException;

    /**
     * 获取区域用户名集合
     *
     * @param type
     * @return
     * @throws SQLException
     */
    HashSet<String> areaUserUsename(String type) throws SQLException;

    /**
     * 修改用户添加笔记的权限
     *
     * @param usename
     * @return
     * @throws SQLException
     */
    boolean findPowerByUsename(String usename) throws SQLException;

    /**
     * 判断用户addpower的权限
     *
     * @param usename
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    User findUserInformation(String usename) throws SQLException, ClassNotFoundException;

    /**
     * 判断用户addpower的权限
     *
     * @param mid
     * @return
     * @throws SQLException
     */
    String findAreaManager(Integer mid) throws SQLException;

    /**
     * 根据用户名查找用户信息
     *
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    ArrayList<User> allUsers() throws SQLException, ClassNotFoundException;

    /**
     * 查找用户管理区域
     *
     * @param mid
     * @return
     * @throws SQLException
     */
    String findManagerUsername(Integer mid) throws SQLException;

    /**
     * 所有用户信息
     *
     * @param type
     * @return
     * @throws SQLException
     */
    Integer findManagerMid(String type) throws SQLException;
}
